<?php
//Start de sessie
session_start();
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Contact</title>
  <meta http-equiv="content-type" content="text/html; charset=utf-8" />
  <link type="text/css" href="css/pagination.css" rel="stylesheet" />
  <link rel="stylesheet" href="css/reset.css" type="text/css" />
  <link rel="stylesheet" href="css/960.css" type="text/css" />
  <link rel="stylesheet" href="css/text.css" type="text/css" />
  <link type="text/css" href="css/tablesorter.css" rel="stylesheet" />
  <link type="text/css" href="css/sunny/jquery-ui-1.8.custom.css" rel="stylesheet" />
  <link type="text/css" href="css/jquery.autocomplete.css" rel="stylesheet" />
  <link type="text/css" href="css/style.css" rel="stylesheet" />
  <link type="text/css" href="css/accmenu.css" rel="stylesheet" />
<script type="text/javascript" src="js/jquery-1.4.2.min.js">
</script>
<script type="text/javascript" src="js/jquery-ui-1.8.custom.min.js">
</script>
<script type="text/javascript" src="js/jquery.tablesorter.js">
</script>
<script type="text/javascript" src="js/jquery.autocomplete.min.js">
</script>
<script type="text/javascript" src="js/menu.js">
</script>
<script type="text/javascript">
//<![CDATA[
$(document).ready(function()
    {
        $("#producttable").tablesorter();
        $("#searchtext").autocomplete("autocomplete.php");
        $("#searchtext").result(function(event, data, formatted) {
			$("#searchform").trigger('submit');
	    });

        $("#loginbox").dialog({
			autoOpen: false,
			height: 230,
			width: 350,
			modal: true,
            buttons: {
				'Login': logincall,
				Cancel: function() {
					$(this).dialog('close');
				}
                }
		});

        $("#login button").button({
            icons: {
                primary: 'ui-icon-locked'
            }
        })
        .click(function() {
				$('#loginbox').dialog('open');
			});
        $("#register button").button();
        $("#logout button").button();
        $("#shoppingcart button").button();
    }
);

function logincall() {
      $.ajax({
      type: "POST",
      url: "login.php",
      data: $("#loginform").serialize(),
      dataType: "text",
      complete: function() {
        $(this).dialog('close');
        $(location).attr('href', "index.php");
      }
    });
  return;
}

//]]>
</script>
</head>

<body>
  <div class="container_12">
    <div id="header" class="grid_12">
      <div class="grid_5 prefix_7 alpha omega">
        <form id="searchform" name="searchform" method="get" action="search.php">
          <input type="text" name="q" id="searchtext" /> <button type="submit" id=
          "searchbutton"></button>
        </form>

        <div id="demo">
          <ul>
            <?php if(!empty($_SESSION['klantid'])){?>
            <li id="logout"><a href="logout.php"><button>Log Out</button></a></li>
            <li id="shoppingcart"><a href="view_cart.php"><button>Winkelwagen</button></a></li>
            <?php } else {?>
            <li id="login"><button>Log In</button></li>
            <li id="register"><a href="register.php"><button>Registreer</button></a></li>
            <?php } ?>
          </ul>


        </div>
        <?php if(!empty($_SESSION['klantid'])){?>
                        <p id="klantwelkom">Welkom <b><a href="account.php"><?php echo $_SESSION['fullname']; ?></a></b>&nbsp;&nbsp;
                        </p><?php } else { ?>
                        <p id="klantwelkom"><a href="forgot_pass.php">Wachtwoord vergeten?</a>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</p>
                        <?php } ?>
      </div>

      <div class="clear"></div>
    </div>

    <div class="clear"></div>

    <div class="grid_12 spacer"></div>

    <div class="clear"></div>

    <div id="menu" class="grid_2">


          <?php
          include_once 'temp/menu_filler.php';
          ?>

     </div>

    <div id="mainarealong" class="grid_7">
        <div id="tableholder">

        <?php

        if (!isset($_POST['Submit']))
        {
                  ?>
                  <table width="400" border="0" align="center" cellpadding="3" cellspacing="1">
                  <tr>
                  <td><h3>Contact formulier</h3></td>
                  </tr>
                  </table>

                  <table width="400" border="0" align="center" cellpadding="0" cellspacing="1">
                  <tr>
                  <td><form name="form1" method="post" action="<?php echo $_SERVER['PHP_SELF']; ?>">
                  <table width="100%" border="0" cellspacing="1" cellpadding="3">
                  <tr>
                  <td width="16%">Onderwerp</td>
                  <td width="2%">:</td>
                  <td width="82%"><input name="subject" type="text" id="subject" size="50"></td>
                  </tr>
                  <tr>
                  <td></td>
                  <td></td>
                  <td><textarea name="detail" cols="50" rows="4" id="detail"></textarea></td>
                  </tr>
                  <tr>
                  <td>Naam</td>
                  <td>:</td>
                  <td><input name="name" type="text" id="name" size="50"></td>
                  </tr>
                  <tr>
                  <td>Email</td>
                  <td>:</td>
                  <td><input name="customer_mail" type="text" id="customer_mail" size="50"></td>
                  </tr>
                  <tr>
                  <td>&nbsp;</td>
                  <td>&nbsp;</td>
                  <td><input type="submit" name="Submit" value="verzend"> <input type="reset" name="Submit2" value="leegmaken"></td>
                  </tr>
                  </table>
                  </form>
                  </td>
                  </tr>
                  </table>
                  <?php
        }
        else
        {
                  $name =$_POST['name'];

                  // Contact subject
                  $subject =$_POST['subject'];
                  // Details
                  $message=$_POST['detail'];

                  // Mail of sender
                  $mail_from=$_POST['customer_mail'];

                  //maak een mailheader from:
                  $header="from: $name <$mail_from>";

                  // Enter your email address
                  $to ='info@danielvandorp.nl';

                  mail($to, $subject, $message, $header);
              	  print "Contactformulier verzonden.";
        }

        ?>

        </div>
    </div>

    <div id="sidebar" class="grid_3"><div id="tableholder"><?php include 'cart.php'; ?></div></div>

    <div class="clear"></div>

    <div class="grid_12 spacer"></div>

    <div class="clear"></div>
</div>
<div id="loginbox">
                <form action="#" method="POST" id="loginform">
                <p><label for="email">Email:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label>
                <input type="text" value="" name="email" class="text ui-widget-content ui-corner-all" /></p>
                <p><label for="wachtwoord">Wachtwoord:</label>
                <input type="password" value="" name="wachtwoord" class="text ui-widget-content ui-corner-all" /></p>
</form>
</div>
<center>
<!-- Begin Motigo Webstats counter code -->
<a id="mws4736564" href="http://webstats.motigo.com/">
<img width="80" height="15" border="0" alt="Free counter and web stats" src="http://m1.webstats.motigo.com/n80x15.gif?id=AEhGNAHBHVZi00ZSyCakWn8n38NA" /></a>
<script src="http://m1.webstats.motigo.com/c.js?id=4736564&amp;lang=NL&amp;i=3" type="text/javascript"></script>
<!-- End Motigo Webstats counter code -->
</center>
<br />

</body>
</html>

